Page({
    data:{
        addressInfo:{
            userName:"",
            phoneNumber:"",
            region:[],
            addressDetail:"",
            doorNumber:""
        },
        isDefault:true, //是否设置为默认地址
        btnText:"保存并使用"
    },
    onLoad(){
        // 动态修改当前页面导航栏标题
        // wx.setNavigationBarTitle({
        //     title:"修改收货地址"
        // });
    },
    // 输入收件人事件监听
    inputUserName(e:any){
        this.data.addressInfo.userName=e.detail.value;
        this.setData({
            addressInfo:this.data.addressInfo
        });
    },
    // 输入联系电话事件监听
    inputPhoneNumber(e:any){
        this.data.addressInfo.phoneNumber=e.detail.value;
        this.setData({
            addressInfo:this.data.addressInfo
        });
    },
    // 输入收货地址事件监听
    inputAddressDetail(e:any){
        this.data.addressInfo.addressDetail=e.detail.value;
        this.setData({
            addressInfo:this.data.addressInfo
        });
    },
    // 输入门牌号事件监听
    inputDoorNumber(e:any){
        this.data.addressInfo.doorNumber=e.detail.value;
        this.setData({
            addressInfo:this.data.addressInfo
        });
    },
    // 选择所在地区下拉事件监听
    selectRegion(e:any){
        this.data.addressInfo.region=e.detail.value;
        this.setData({
            addressInfo:this.data.addressInfo
        });
    },
    // 设置默认地址
    setDefaultAddress(){
        this.setData({
            isDefault:!this.data.isDefault
        });
    }
});